package coordenadas;

public class Matrices {
	private double [][]R = new double[3][3];
	private double [] XYZ = new double [3];
	private double [] Coordenadas = new double [3];

	public double[][] getR() {
		return R;
	}

	public void setR(double omegaMay, double omegaMin, double inclinacion) {
		R[0][0] = ((Math.cos(omegaMay)*Math.cos(omegaMin)) - 
				(Math.sin(omegaMay)*Math.sin(omegaMin)*Math.cos(inclinacion)));
		R[0][1] = ((-1*(Math.cos(omegaMay)*Math.sin(omegaMin)))-
				(Math.sin(omegaMay)*Math.cos(omegaMin)*Math.cos(inclinacion)));
		R[0][2] = Math.sin(omegaMay)*Math.sin(inclinacion);
		R[1][0] = ((Math.sin(omegaMay)*Math.cos(omegaMin))+(Math.cos(omegaMay)*Math.sin(omegaMin)
				* Math.cos(inclinacion)));
		R[1][1] = ((-1 * Math.sin(omegaMay) * Math.sin(omegaMin)) + (Math.cos(omegaMay) * Math.cos(omegaMin) 
				* Math.cos(inclinacion)));
		R[1][2] = -1 * Math.cos(omegaMay) * Math.sin(inclinacion);
		R[2][0] = (Math.sinh(omegaMin) * Math.sin(inclinacion));
		R[2][1] = Math.cos(omegaMin) * Math.sin(inclinacion);
		R[2][2] = Math.cos(inclinacion);
	}

	public double[] getXYZ() {
		return XYZ;
	}

	public void setXYZ(double X, double Y, double Z) {
		
		XYZ[0] = X;
		XYZ[1] = Y;
		XYZ[2] = Z;
	}
	
	public double[] productoMat(){
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				Coordenadas[i] += R[i][j] * XYZ[j];
			}
		}
		return Coordenadas;
	}//Fin producot matricial
}
